﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using Medianamik.Core.Security;
using System.Web;
using Medianamik.Core;

namespace Medianamik.Core
{
    public class MedianamikTemplate : SystemNode<MedianamikTemplate>
    {
        #region .ctors

        public MedianamikTemplate()
            : base()
        {

        }

        #endregion

        #region Properties

        #region ISystemNode Members

        public override Guid SystemNodeTypeID
        {
            get { return MedianamikTypes.MedianamikTemplate; }
        }

        #endregion

        #region Language Neutral Properties

        public string Content
        {
            get
            {
                return DefaultInstance["Content"].GetValue<string>();
            }
        }

        #endregion

        public override WebSite WebSite
        {
            get
            {
                if (!_checkHasBeenDone)
                {
                    _checkHasBeenDone = true;
                    Guid? siteId = this.DefaultInstance.Properties["WebSite"].GetValue<Guid?>();
                    if (siteId.HasValue)
                        _site = ConfigManager.Get<WebSite>(siteId.Value);
                }
                return _site;
            }
        }
        WebSite _site;
        bool _checkHasBeenDone = false;

        public string WebSiteName
        {
            get
            {
                if (WebSite != null)
                    return WebSite.Name;

                return "";
            }
        }

        #endregion

        #region Methods



        #endregion
    }
}